<?php
/**数据库  PDO 配置文件**/

/**added by 2017/07/14  **/

date_default_timezone_set('PRC'); 

DEFINE('DB_TYPE','mysql');
DEFINE('DB_HOST','127.0.0.1');
DEFINE('DB_NAME','ssc');
DEFINE('DB_USER','root');
DEFINE('DB_PWD','Xqh!!2017');
DEFINE('DB_PORT','3306');

/**pdo连接**/
function pdo_write_read_link()
{
	try
	{ 
		$dsn = DB_TYPE.':host='.DB_HOST.';dbname='.DB_NAME;
		$user = DB_USER;
		$password = DB_PWD;
		$pdo = new PDO($dsn, $user, $password);
		$pdo->setAttribute(PDO::ATTR_PERSISTENT, true);  
		$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);  
		$pdo->setAttribute(PDO::ATTR_ORACLE_NULLS, true);  
		$pdo->query('SET NAMES utf8'); 
	}catch (PDOException $e) 
	{ 
		exit('connection failed：'. $e->getMessage()); 
	} 
	
	return $pdo;
}


